<template>
       <el-menu router
          :default-active="$route.path"
          class="el-menu-vertical-demo"
          unique-opened
        >
        
      <div v-for="(item,index) in meanuList" :key="item.path">
            <el-submenu v-if="item.children" :index="item.path">
          <template slot="title">
            <i :class="['iconfont',item.icon]"></i>
            <span>{{item.title}}</span>
          </template>
  
            <el-menu-item-group v-for="(item,index) in item.children" :key="item.path" >
              <el-menu-item :index="item.path">{{item.title}}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
           <el-menu-item v-else  :index="item.path">
            <i :class="['iconfont',item.icon]"></i>
            <span slot="title">{{item.title}}</span>
          </el-menu-item>
      </div>
  
  <!-- 
          <el-menu-item index="/home">
            <i class="el-icon-menu"></i>
            <span slot="title">后台首页</span>
          </el-menu-item>
  
          <el-menu-item index="/order/list">
            <i class="el-icon-menu"></i>
            <span slot="title">订单管理</span>
          </el-menu-item>
  
           <el-submenu index="/goods">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>商品管理</span>
          </template>
            <el-menu-item index="/goods/list">商品列表</el-menu-item>
            <el-menu-item index="/goods/save">添加商品</el-menu-item>
            <el-menu-item index="/goods/goodstype">添加类别</el-menu-item>
          </el-menu-item-group>
         
        </el-submenu>
  
          <el-menu-item index="/shop">
            <i class="el-icon-setting"></i>
            <span slot="title">店铺管理</span>
          </el-menu-item>
  
  <el-submenu index="/users">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>账号管理</span>
          </template>
            <el-menu-item index="/users/list">账号列表</el-menu-item>
            <el-menu-item index="/users/save">添加账号</el-menu-item>
            <el-menu-item index="/users/userpwd">修改密码</el-menu-item>
            <el-menu-item index="/users/personal">个人中心</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
  
  
  
  <el-submenu index="/census">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>统计管理</span>
          </template>
            <el-menu-item index="/census/goods">商品列表</el-menu-item>
            <el-menu-item index="/census/order">订单列表</el-menu-item>
          </el-menu-item-group>
        </el-submenu> -->
        </el-menu>
</template>

<script>
export default {
  data() {
    return {
      meanuList: [
        { path: "/home", icon: "el-icon-menu", title: "后台首页" },
        { path: "/order", icon: "el-icon-menu", title: "订单管理" },
        {
          path: "/goods",
          icon: "el-icon-menu",
          title: "商品管理",
          children: [
            { path: "/goods/list", title: "商品列表" },
            { path: "/goods/save", title: "添加商品" },
            { path: "/goods/goodstype", title: "添加类别" },
          ],
        },
        { path: "/shop", icon: "el-icon-star-off", title: "店铺管理" },

        {
          path: "/users",
          icon: "el-icon-menu",
          title: "账号管理",
          children: [
            { path: "/users/list", title: "账号列表" },
            { path: "/users/save", title: "添加账号" },
            { path: "/users/userpwd", title: "修改密码" },
            { path: "/users/personal", title: "个人中心" },
          ],
        },
        {
          path: "/census",
          title: "统计管理",
          icon: "el-icon-menu",
          children: [
            { path: "/census/goods", title: "商品列表" },
            { path: "/census/order", title: "订单列表" },
          ],
        },
      ],
    };
  },
};
</script>

<style lang="less" scoped>
</style>